function MM_findObj(n, d)
{
	 var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length)
	{
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
  if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n);
  return x;
}

function ajax_call(cmethod,relate_url,change_func,setdata_func)
{
	cmethod = cmethod.toUpperCase();

	if (window.XMLHttpRequest)
	{
		req = (req == '') ? new XMLHttpRequest() : req;
		req.onreadystatechange = function(){eval(change_func);};
		req.open(cmethod, relate_url, true);
		req.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=gbk');
		if(cmethod == "POST")
		{
			if( ! (data = setdata_func()) )
			{
				return false;
			}
		}
		else
		{
			data = null;
		}
		req.send(data);
	}
	else if (window.ActiveXObject)
	{
		//req = (req instanceof Object) ? new ActiveXObject("Microsoft.XMLHTTP") : req;
		req =  new ActiveXObject("Microsoft.XMLHTTP");
		if (req)
		{
			req.onreadystatechange =  function(){eval(change_func)};
			req.open(cmethod, relate_url, true);
			req.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=gbk');
			if(cmethod == "POST")
			{
				if( !(data = setdata_func()) )
				{
					return false;
				}
			}
			else
			{
				data = null;
			}
			req.send(data);
		}
	}
}

$(document).ready(function()
{
	$("#loading_tips").replaceWith('');
	$("#mask").css("display","block");
	$("#main_news_block > ul").tabs();
	//$("#main_news_block > ul").tabs("disable",3);

	$("#main_image_block").css("display","block");
	$("#main_image_block > ul").tabs();

	if( location.href.indexOf('&') > 0 )
	{
		var url = parse_url(location.href);
		callme( decodeURIComponent(url['url']), decodeURIComponent(url['title']) );
	}
	//$("#main_news_block > ul").tabs('rotate', 5000);
	//$("#main_news_block > ul").tabs("add","http://localhost/mini-eye/t.php", '站点名称', 3)
	//$("#main_news_block > ul").tabs("select",3)
});

function parse_url(url)
{
	if(url.length <= 0) return false;
	if( url.indexOf('?') <= 0 ) return false;
	var query_string = url.substr( url.indexOf('?')+1 );
	var arg = new Array();
	if( query_string.indexOf('&') > 0 )
	{
		arg = query_string.split('&');
	}else{
		arg[0] = query_string;
	}

	var token;
	var ret = new Array();
	for(var i=0; i<arg.length; i++)
	{
		if( arg[i].indexOf('=') >= 0 )
		{
			token = arg[i].split('=');
			ret[token[0]] = token[1];
		}else{
			ret[token[0]] = '';
		}
	}

	return ret;
}